import 'package:flutter/cupertino.dart';
import 'package:kq_flutter_widgets/special/seekBarForScienceTestMold/simple_science_test_mold_edit.dart';
import 'package:kq_flutter_widgets/special/seekBarForScienceTestMold/simple_science_test_mold_result.dart';

/// @author 高裕
/// 科学试模图形工具
class SimpleScienceTestMoldViewUtil {
  /// 科学试模编辑滑块列表
  static List<Widget> createSimpleScienceTestMoldEditList<
      T extends SimpleScienceTestMoldEditEntity>(List<T> list) {
    List<Widget> widgetList = [];
    for (T entity in list) {
      widgetList.add(SimpleScienceTestMoldEdit(
        entity: entity,
      ));
    }
    return widgetList;
  }

  /// 科学试模结果滑块列表
  static List<Widget> createSimpleScienceTestMoldResultList<
      T extends SimpleScienceTestMoldResultEntity>(List<T> list) {
    List<Widget> widgetList = [];
    for (T entity in list) {
      widgetList.add(SimpleScienceTestMoldResult(
        entity: entity,
      ));
    }
    return widgetList;
  }

  /// 清空所有科学试模滑块视图
  static clearAllSimpleScienceTestMoldView<
          T extends SimpleScienceTestMoldEditEntity,
          R extends SimpleScienceTestMoldResultEntity>(
      List<T> editList, List<R> resultList) {
    for (T t in editList) {
      t.state?.clear();
    }
    for (R r in resultList) {
      r.state?.clear();
    }
  }
}
